#!/usr/bin/env python
#
#   Copyright (C) 2006 Jonathan Saggau                                    
#   saggau@gmail.com                                                      
#                                                                         
#   This program is free software; you can redistribute it and/or modify  
#   it under the terms of the GNU General Public License as published by  
#   the Free Software Foundation; either version 2 of the License, or     
#   (at your option) any later version.                                   
#                                                                         
#   This program is distributed in the hope that it will be useful,       
#   but WITHOUT ANY WARRANTY; without even the implied warranty of        
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
#   GNU General Public License for more details.                          
#                                                                         
#   You should have received a copy of the GNU General Public License     
#   along with this program; if not, write to the                         
#   Free Software Foundation, Inc.,                                       
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
#

"""Node Commands"""

# add actions:
#0 - add the new node to the the head of the group 
#    specified by the add target ID.
#1 - add the new node to the the tail of the group
#    specified by the add target ID.
#2 - add the new node just before the node
#    specified by the add target ID.
#3 - add the new node just after the node
#    specified by the add target ID.
#4 - the new node replaces the node specified by the add target ID.

HEAD = 0
TAIL = 1
BEFORE = 2
AFTER = 3
REPLACE = 4

import msg

def free(*nodenumbers):
    return msg.msg("/n_free", nodenumbers)
    
def run(idRunflagDict):
    return msg.dictmsg("/n_run", idRunflagDict)
    
def set(id, indexValueDict): 
    return msg.dictmsg(["/n_set", id], indexValueDict)
    
def setn(id, indexValuesDict):
    return msg.setnmsg('/n_setn', id, indexValuesDict)
    
def fill(id, indexNumValueDict):
    """indexNumsValueDict = index: [number_of_values_to_fill, value]"""
    return msg.dictmsg(["/n_fill", id], indexNumValueDict)
    
def map(id, indexValueDict): 
    return msg.dictmsg(["/n_map", id], indexValueDict)
    
def mapn(id, indexNumValueDict):
    """{index:[acontrolindexorname:[index, map]}"""
    return msg.dictmsg(["/n_mapn", id], indexNumValueDict)
    
def before(placeThisBeforeThatDict):
    return msg.dictmsg("/n_before", placeThisBeforeThatDict)
    
def after(placeThisAfterThatDict): 
    return msg.dictmsg("/n_after", placeThisAfterThatDict)
    
def query(*ids):
    return msg.msg('/n_query', ids)
    
def trace(*ids):
    return msg.msg('/n_trace', ids)

def test():
    pass

if __name__ == "__main__":
    test()
